#include<stdio.h>
#include<unistd.h>
#include<fcntl.h>


int main(int argc, char *argv[]){

        
    int fd;
    if((fd = open("t_fcntl_dup.txt",O_WRONLY|O_CREAT,0666)) < 0){
        
        perror("open error");
    }    

    close(STDOUT_FILENO);
    fcntl(fd,F_DUPFD,STDOUT_FILENO);
    
    printf("sadassassin");

    close(fd);

    return 0;
}

